package com.xhwl.logistics.service.cent.server;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xhwl.common.dto.cent.vehicle.feign.VehicleParkingLotQuery;
import com.xhwl.logistics.bo.VehicleParkingLotBO;
import com.xhwl.logistics.bo.input.PageBO;
import com.xhwl.logistics.bo.input.QueryVehicleParkingLotBO;
import com.xhwl.logistics.converter.ToPageBO;
import com.xhwl.logistics.converter.ToPageVO;
import com.xhwl.logistics.converter.mapstruct.VehicleParkingLotConverter;
import com.xhwl.logistics.service.IVehicleParkingLotService;
import com.xhwl.logistics.vo.PageVO;
import com.xhwl.logistics.vo.VehicleParkingLotVO;
import org.springframework.beans.factory.annotation.Autowired;

//@Service
public class VehicleParkingLotFeignServiceImpl implements IVehicleParkingLotFeignService {

    @Autowired
    private IVehicleParkingLotService vehicleParkingLotService;

    @Autowired
    private VehicleParkingLotConverter vehicleParkingLotConverter;

    @Autowired
    private ToPageBO toPageBO;

    @Autowired
    private ToPageVO toPageVO;

    @Override
    public PageVO<VehicleParkingLotVO> parkingLotPage(VehicleParkingLotQuery vehicleParkingLotQuery) {

        QueryVehicleParkingLotBO queryVehicleParkingLotBO = vehicleParkingLotConverter.vehicleParkingLotQuery2QueryVehicleParkingLotBO(vehicleParkingLotQuery);
        PageBO pageBO = toPageBO.toPageBOForParkingLot(vehicleParkingLotQuery);

        IPage<VehicleParkingLotBO> vehicleParkingLotBOIPage = vehicleParkingLotService.queryParkingLot(queryVehicleParkingLotBO, pageBO);

        return toPageVO.toPageVO(vehicleParkingLotBOIPage, vehicleParkingLotConverter.vehicleParkingLotBOList2VehicleParkingLotVOList(vehicleParkingLotBOIPage.getRecords()));
    }

}
